#include <stdio.h>
#include <stdlib.h>
#define N 1000
int arr5[N+1]={0};

int main_24()
{
    int n,d,diff=10000;
    scanf("%d",&n);
    for (int i=0;i<n ;i++ )
    {
        scanf("%d",&arr5[i]);
        for (int j=0;j<i ;j++ )
        {
            d=abs(arr5[i]-arr5[j]);
            diff=d<diff?d:diff;
        }
    }
    printf("%d\n",diff);
	return 0;
}
